package com.zhongan.gateway.common.utils;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;

/**
 * Created by sibo.wang on 16/12/16.
 */
public class HttpServletUtil {
    /**
     * 取getRequestBodyStr
     * @param httpServletRequest
     * @return
     */
    public static String getRequestBodyStr(HttpServletRequest httpServletRequest) throws Exception{
        BufferedReader br = httpServletRequest.getReader();
        String str, wholeStr = "";
        //遍历取出requestBodyStr
        while((str = br.readLine()) != null) {
            wholeStr += str;
        }
        return wholeStr;
    }
}
